﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MastePage/SubEmptyMaster.Master" AutoEventWireup="true"
    CodeBehind="QuerySKnifByUse.aspx.cs" Inherits="BySoft.Web.Site.ComPage.QuerySKnifByUse" %>

<%@ Register Assembly="OneSoft.Web" Namespace="OneSoft.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register Assembly="BySoft.Web.Controls" Namespace="BySoft.Web.Controls" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlace" runat="server">
    <script language="javascript" type="text/javascript">
        function CheckAll(con) {
            var dom = document.getElementById("<%=grdResult.ClientID %>").getElementsByTagName("*");

            for (i = 0; i < dom.length; i++) {
                if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                    dom[i].checked = document.getElementById(con.id).checked;
                }
            }
        }

        function CheckSingle(con) {
            var dom = document.getElementById("<%=grdResult.ClientID %>").getElementsByTagName("*");
            if (!document.getElementById(con.id).checked) {
                for (i = 0; i < dom.length; i++) {
                    if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                        dom[i].checked = false;
                        break;
                    }
                }
            }
            else {
                var choose = true;
                var first = true;
                for (i = 0; i < dom.length; i++) {
                    if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                        if (first == false) {
                            if (dom[i].checked == false) {
                                choose = false;
                                break;
                            }
                        }
                        else {
                            first = false;
                        }
                    }
                }

                for (i = 0; i < dom.length; i++) {
                    if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                        dom[i].checked = choose;
                        break;
                    }
                }
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="EmptyMasteCPH" runat="server">
    <br />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <%--查询条件--%>
            <div class="searchTable">
                
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <th class="left2">刀具编号：
                        </th>
                        <td class="right2">
                            <asp:TextBox CssClass="fullWidth" ID="txtKnifeID" runat="server"></asp:TextBox>
                        </td>
                        <th class="left2">制单编号：
                        </th>
                        <td class="right2">
                            <asp:TextBox CssClass="fullWidth" ID="txtWorkOrderNo" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th class="left2">刀具类型：
                        </th>
                        <td class="right2">
                            <asp:DropDownList ID="ddlKnifeType" runat="server" Width="90%"></asp:DropDownList>
                        </td>
                        <th></th>
                        <td></td>
                    </tr>
                </table>
                <div class="btnStylef">
                    <label class="btnStyleb png_bg">
                        <asp:Button Text="查询" runat="server" ID="btnQuery" OnClick="btnQuery_Click" />
                    </label>
                </div>
            </div>
            
            <h4 style="color:#ff6a00">只有排程中的产品所用刀具才显示在下表</h4>
            <%--列表--%>
            <div class="tableStyle">
                <asp:SGridView runat="server" ID="grdResult" Width="100%" ShowActionToolBar="false"
                    AutoGenerateColumns="false" AllowCascade="false">
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:CheckBox ID="cbAll" runat="server" onclick="CheckAll(this)" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="cbChoose" runat="server" onclick="CheckSingle(this)" />
                            </ItemTemplate>
                        </asp:TemplateField>
                       

                         <asp:TemplateField>
                            <HeaderTemplate>
                                刀具编号
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblKnifeID" runat="server" Text='<%#Eval("KnifeID") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                刀具名称
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblKnifeName" runat="server" Text='<%#Eval("KnifeName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                刀具类型
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblKnifeType" runat="server" Text='<%#Eval("KnifeTypeName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                规格
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblSpecifications" runat="server" Text='<%#Eval("Specifications") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                单位
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblUnit" runat="server" Text='<%#Eval("Unit") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>

                      
                        <asp:TemplateField>
                            <HeaderTemplate>
                                所属客户
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblBelongCustomer" runat="server" Text='<%#Eval("BelongCustomer") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>

                         <asp:TemplateField>
                            <HeaderTemplate>
                                制单编号
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblWorkOrderNo" runat="server" Text='<%#Eval("WorkOrderNo") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>

                         <asp:TemplateField>
                            <HeaderTemplate>
                                产品编号
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblProductID" runat="server" Text='<%#Eval("ProductID") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                         <asp:TemplateField>
                            <HeaderTemplate>
                                产品名称
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblProductName" runat="server" Text='<%#Eval("ProductName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        
                         
                       <%-- <asp:TemplateField>
                            <HeaderTemplate>
                                库存数量
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblStockNums" runat="server" Text='<%#Eval("StockNums") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>--%>
                    </Columns>
                </asp:SGridView>
                <div style="padding-top: 5px" align="right">
                    <cc1:PagingControl ID="pcData" runat="server" OnPageIndexClick="pcData_PageIndexClick" />
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div class="tableStyle2">
        <div class="controlBar" style="padding-right: 300px;">
            <label class="btnStylec png_bg">
                <asp:Button ID="btnOk" CssClass="png_bg" runat="server" Text="确认" OnClick="btnOk_Click" /></label>
            <label class="btnStylec png_bg">
                <input id="btnBack" type="button" class="png_bg" value="取消" onclick="CloseTopDialog();" /></label>
        </div>
    </div>
</asp:Content>

